﻿@using Telerik.Web.Mvc.UI;
@using System.Linq;
@model Telerik.Web.Mvc.GridModel<ShippingMethodModel>
@{    
    ViewBag.Title = T("Admin.Configuration.Shipping.Methods").Text;
}

<div class="section-header">
    <div class="title">
        <i class="fa fa-truck"></i>
        @T("Admin.Configuration.Shipping.Methods")
    </div>
    <div class="options">
        <a href="@Url.Action("CreateMethod")" class="btn btn-primary">
			<i class="fa fa-plus"></i>
			<span>@T("Admin.Common.AddNew")</span>
		</a>
    </div>
</div>

<div>
	@(Html.Telerik().Grid<ShippingMethodModel>(Model.Data)
			.Name("shippingmethod-grid")
			.DataKeys(x =>
			{
				x.Add(y => y.Id).RouteKey("Id");
			})
			.Columns(columns =>
			{
				columns.Bound(x => x.Name)
					.Template(x => Html.ActionLink(x.Name, "EditMethod", new { id = x.Id }))
					.ClientTemplate("<a href=\"EditMethod/<#= Id #>\"><#= Name #></a>");
				columns.Bound(x => x.Description);
				columns.Bound(x => x.LimitedToStores)
					.Template(item => @Html.SymbolForBool(item.LimitedToStores))
					.ClientTemplate(@Html.SymbolForBool("LimitedToStores"))
					.Width(180)
					.Centered();
				columns.Bound(x => x.IgnoreCharges)
					.Template(item => @Html.SymbolForBool(item.IgnoreCharges))
					.ClientTemplate(@Html.SymbolForBool("IgnoreCharges"))
					.Width(250)
					.Centered();
				columns.Bound(x => x.DisplayOrder)
					.Width(180)
					.Centered();
			})
			.DataBinding(dataBinding => dataBinding.Ajax().Select("Methods", "Shipping"))
			.EnableCustomBinding(true))
</div>

